#include "HttpServer.hpp"
#include <iostream>
#include <memory>

void Usage(const std::string& proc)
{
    std::cout << "\n\rUsage: " << proc << "port[1024+]\n" << std::endl;
}

int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(1);
    }
    uint16_t serverport = std::stoi(argv[1]);

    std::unique_ptr<HttpServer> http_svr(new HttpServer(serverport));
    http_svr->InitServer();
    http_svr->StartServer();
    return 0;
}

//开放防火墙端口号，需要云服务器平台和Linux内部同时修改
//root下:
//systemctl start firewalld.service 打开防火墙
//firewall-cmd --state 查看防火墙状态
//firewall-cmd --zone=public --list-ports 查看所有的开放端口
//firewall-cmd --zone=public --add-port=xx/tcp 添加端口号
//firewall-cmd --zone=public --remove-port=xx/tcp 删除端口号
//firewall-cmd --reload 重新载入